package org.opensmile.website.springmvc.controller;

import org.opensmile.website.domain.Sys_role;
import org.opensmile.website.domain.Sys_roleExample;
import org.opensmile.website.service.Sys_roleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class HomeController {

	@Autowired
	private Sys_roleService sys_roleService;
	
	private Sys_role sys_role;
	
	@RequestMapping(value="/")
	public String home(Model model){
		sys_role =sys_roleService.getAccount("zc");
		  System.out.println(sys_role.getName());
		  Sys_roleExample example =new Sys_roleExample();
		  System.out.println(sys_roleService.getCount(example));
		return "home";
	}
	
	@RequestMapping(value="/{username}")
	public String home(@PathVariable String username,Model model){
		model.addAttribute("username", username);
		return "home";
	}
	
	@RequestMapping(value="/login")
	public String login(){
		return "../login";
	}
}
